<?php
include("../includes/config.php");
	$msg = "";
	if( (@$_POST['user']) || (@$_POST['pass']) ){
		$user = mysql_real_escape_string($_POST['user']);
		$pass = mysql_real_escape_string($_POST['pass']);
		$res = mysql_query("select * from admins where username = '$user' and password = '$pass'");
		if(mysql_num_rows($res) == 0){
			$msg = '<b class="errortxt">Utilizator sau parola incorecte!</b>';
		}else{
			$_SESSION['loginAdmin'] = $user;
			header("location: /admin/index.php");
		}
	}
?>
<html>
	<head>
		<link href="css/style.css" rel="stylesheet">
		<link href="../css/start/jquery-ui-1.10.4.custom.css" rel="stylesheet">
	</head>
	<body>
		<div class="login">
		<form action="" method="post">
			<p>
				<label>Utilizator</label><br />
				<input class="imputTxt" type="text" name="user" value="" />
			</p>
			<p>
				<label>Parola</label><br />
				<input class="imputTxt" type="password" name="pass" value="" />
			</p>
			<p>
				<br />
				<input class="imputTxt" type="submit"  value="Login" />
			</p>
			</form>
			<p align="center">
				<?php echo $msg;?>
			</p>
		</div>
	</body>
</html>